1. Field of the Invention
The present invention relates to a method of detecting the position of an object pattern in an image, and more particularly, to a method of position recognition which may be suitably applied for recognizing an object pattern having good shape reproducibility such as a pattern on the surface of an integrated circuit.
2. Description of the Prior Art
Conventionally, a position of a surface pattern of an integrated circuit is detected by a so-called template matching method in which a reference pattern having the shape to be detected has been previously registered as a template, an image is picked up by a television camera, the pattern of each section of the picked-up image is binary-coded, and then the binary-coded data of the pattern are sequentially compared with the template for detecting the position where the best matching between the two is obtained.
This method will be described in more detail with reference to FIGS. 5A and 5B. FIG. 5A shows a binary-coded template 51 in which the pattern to be detected is binary-coded by denoting a white pixel by the digit "1" and denoting a black pixel by the digit "0". A binary-coded image 52 to be inspected is shown in FIG. 5B. In practice, the template 51 is produced only in a computer, and not actually formed in a physical body as shown in FIG. 5A, and thus the processes described below are conducted in the computer. The template 51 is superimposed over an area in the top left-hand corner of the object image 52, and the matching status between the facing pixels is examined. If "0" is superimposed on "0" or "1" on "1", it is determined that the pixels match each other. Next, the template 51 is moved by one pixel to the right for performing the examination in the same manner. Such examination is repeated until the template 51 is moved to the bottom right-hand corner of the image 52. Thereafter, the area having the highest matching rate is determined as the recognition point. In the case of the image 52, the area indicated by C has the highest matching rate (i.e., 64), and, therefore, the area C is detected as the recognition point. In other words, the area C has the object pattern.
However, the above method has a drawback in that, if the lightness of a body changes, the binary-coded image of the body also changes, leading to a recognition error or a total failure of recognition. For example, when the body from which the binary-coded image of FIG. 5B is obtained under a bright condition is processed under a dark condition to obtain a binary-coded image thereof, all pixels of the obtained binary-coded image turn into the state of "0", leaving no pixels in the state of "1". Therefore, the matching rate will become the same at any position, resulting in that the position of the object pattern cannot be determined. The above-mentioned drawback is caused also by changing the reflectivity of the body to be inspected or by changing the illuminance on the body.